class StubFile
  @@models ||= []

  def self.open path, mode, &block
    target_stub = @@models.reject { |m| m.path != path }.first
    block.call target_stub
  end

  def self.clear!
    @@models = []
  end

  attr_reader :content, :path

  def initialize content, path
    @content = content
    @path = path
    @@models << self
  end

  def write new_content
    @content = new_content
  end

end
